<template>
  <div>
    <el-button @click="lookorder">点击查看待评论订单</el-button>
    <el-row v-for="(el, index) in housearr" :key="index" class="housebox">
      <el-col :span="4">
        <img :src="el.pictrue" />
      </el-col>
      <el-col :span="4">
        <p>{{ el.name }}</p>
        <div>
          <el-button type="success" round>更多房源</el-button>
          <el-button type="primary" round @click="conponent(index, el.hid)"
            >去评价</el-button
          >
        </div>
      </el-col>
      <el-col :span="16"> </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { getCurrentInstance, ref } from "vue";
import { useRouter, useRoute } from "vue-router";
let router = useRouter();
let route = useRoute();
// console.log(route.query.index);
let arrindex = [];
arrindex.push(route.query.index)
let { proxy } = getCurrentInstance();
// let token=localStorage.getItem('token');
let token = 8;
let housearr = ref([]);
let count = ref(0);
// 请求该用户订单消息
let lookorder=async () => {
  let res = await proxy.$axios(`/userorder?token=${token}`);
  //   console.log(res);
  housearr.value = res.data.resultarr;
  count.value = res.data.resultarr.length;
}
let conponent = (index, hid) => {
  router.push({ path: "/noticepingjia", query: { index, hid } });
};
let minus = () => {
  if (arrindex[0]) {
    housearr.value.splice(arrindex[0], 1);
    count.value = housearr.value.length;
    arrindex.shift();
  } else if (housearr.value.length == 0) {
    housearr.value = [];
    count.value = 0;
  }
};
</script>

<style lang='scss' scoped>
.item {
  margin-top: 10px;
  margin-right: 40px;
}
.housebox {
  margin-top: 20px;
  margin-left: 50px;
  img {
    width: 80%;
  }
  .icon {
    vertical-align: middle;
  }
}
</style>